package com.google.tts;

import android.content.ComponentName;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.MenuItem;
import java.util.HashMap;
import java.util.List;

public class PrefsActivity extends PreferenceActivity
{
  private static final int TTS_VOICE_DATA_CHECK_CODE = 42;
  private static final int TTS_VOICE_DATA_INSTALL_CODE = 43;
  private HashMap<String, Integer> hellos;
  private TTS myTts;
  private TTS.InitListener ttsInitListener = new 1(this);

  private void loadEngines()
  {
    ListPreference localListPreference = (ListPreference)findPreference("engine_pref");
    Intent localIntent = new Intent("android.intent.action.START_TTS_ENGINE");
    ResolveInfo[] arrayOfResolveInfo1 = new ResolveInfo[0];
    PackageManager localPackageManager = getPackageManager();
    ResolveInfo[] arrayOfResolveInfo2 = (ResolveInfo[])localPackageManager.queryIntentActivities(localIntent, 0).toArray(arrayOfResolveInfo1);
    CharSequence[] arrayOfCharSequence1 = new CharSequence[arrayOfResolveInfo2.length];
    CharSequence[] arrayOfCharSequence2 = new CharSequence[arrayOfResolveInfo2.length];
    for (int i = 0; ; ++i)
    {
      if (i >= arrayOfResolveInfo2.length)
      {
        localListPreference.setEntries(arrayOfCharSequence1);
        localListPreference.setEntryValues(arrayOfCharSequence2);
        localListPreference.setOnPreferenceChangeListener(new 2(this));
        return;
      }
      arrayOfCharSequence1[i] = arrayOfResolveInfo2[i].loadLabel(localPackageManager);
      ActivityInfo localActivityInfo = arrayOfResolveInfo2[i].activityInfo;
      String str = localActivityInfo.name.replace(new StringBuilder(String.valueOf(localActivityInfo.packageName)).append(".").toString(), "") + ".so".toLowerCase();
      arrayOfCharSequence2[i] = "/data/data/" + localActivityInfo.packageName + "/lib/libtts" + str;
    }
  }

  private void loadHellos()
  {
    this.hellos = new HashMap();
    this.hellos.put("afr", Integer.valueOf(2131165187));
    this.hellos.put("bos", Integer.valueOf(2131165188));
    this.hellos.put("yue", Integer.valueOf(2131165189));
    this.hellos.put("cmn", Integer.valueOf(2131165190));
    this.hellos.put("hrv", Integer.valueOf(2131165191));
    this.hellos.put("ces", Integer.valueOf(2131165192));
    this.hellos.put("nld", Integer.valueOf(2131165193));
    this.hellos.put("eng-USA", Integer.valueOf(2131165194));
    this.hellos.put("eng-GBR", Integer.valueOf(2131165195));
    this.hellos.put("epo", Integer.valueOf(2131165196));
    this.hellos.put("fin", Integer.valueOf(2131165197));
    this.hellos.put("fra", Integer.valueOf(2131165198));
    this.hellos.put("deu", Integer.valueOf(2131165199));
    this.hellos.put("ell", Integer.valueOf(2131165200));
    this.hellos.put("hin", Integer.valueOf(2131165201));
    this.hellos.put("hun", Integer.valueOf(2131165202));
    this.hellos.put("isl", Integer.valueOf(2131165203));
    this.hellos.put("ind", Integer.valueOf(2131165204));
    this.hellos.put("ita", Integer.valueOf(2131165205));
    this.hellos.put("kur", Integer.valueOf(2131165206));
    this.hellos.put("lat", Integer.valueOf(2131165207));
    this.hellos.put("mkd", Integer.valueOf(2131165208));
    this.hellos.put("nor", Integer.valueOf(2131165209));
    this.hellos.put("pol", Integer.valueOf(2131165210));
    this.hellos.put("por", Integer.valueOf(2131165211));
    this.hellos.put("ron", Integer.valueOf(2131165212));
    this.hellos.put("rus", Integer.valueOf(2131165213));
    this.hellos.put("srp", Integer.valueOf(2131165214));
    this.hellos.put("slk", Integer.valueOf(2131165215));
    this.hellos.put("spa", Integer.valueOf(2131165216));
    this.hellos.put("spa-MEX", Integer.valueOf(2131165217));
    this.hellos.put("swe", Integer.valueOf(2131165218));
    this.hellos.put("swe", Integer.valueOf(2131165219));
    this.hellos.put("tam", Integer.valueOf(2131165220));
    this.hellos.put("tur", Integer.valueOf(2131165221));
    this.hellos.put("vie", Integer.valueOf(2131165222));
    this.hellos.put("cym", Integer.valueOf(2131165223));
  }

  private void sayHello()
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    String str1 = localSharedPreferences.getString("engine_pref", "/data/data/com.google.tts/lib/libttspico.so");
    this.myTts.setEngine(str1);
    String str2 = localSharedPreferences.getString("lang_pref", "eng-USA");
    int i = Integer.parseInt(localSharedPreferences.getString("rate_pref", "140"));
    this.myTts.setLanguage(str2);
    this.myTts.setSpeechRate(i);
    if (!(this.hellos.containsKey(str2)))
      str2 = "eng-USA";
    String str3 = getString(((Integer)this.hellos.get(str2)).intValue());
    this.myTts.speak(str3, 0, null);
  }

  public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    if ((paramInt1 != 42) || (paramInt2 == 1))
      return;
    Intent localIntent = new Intent();
    localIntent.setAction("android.speech.tts.engine.INSTALL_TTS_DATA");
    localIntent.setClassName("com.svox.pico", "com.svox.pico.DownloadVoiceData");
    startActivityForResult(localIntent, 43);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setVolumeControlStream(3);
    this.myTts = new TTS(this, this.ttsInitListener, true);
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    paramMenu.add(0, 2131165185, 0, 2131165185).setIcon(17301583);
    paramMenu.add(0, 2131165186, 0, 2131165186).setIcon(17301569);
    return super.onCreateOptionsMenu(paramMenu);
  }

  protected void onDestroy()
  {
    if (this.myTts != null)
      this.myTts.shutdown();
    super.onDestroy();
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    Intent localIntent = new Intent();
    localIntent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
    localIntent.setAction("android.intent.action.VIEW");
    localIntent.addCategory("android.intent.category.BROWSABLE");
    switch (paramMenuItem.getItemId())
    {
    default:
    case 2131165185:
    case 2131165186:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      localIntent.setData(Uri.parse("http://eyes-free.googlecode.com/svn/trunk/documentation/tts_apps.html"));
      startActivity(localIntent);
      continue;
      localIntent.setData(Uri.parse("http://eyes-free.googlecode.com/"));
      startActivity(localIntent);
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     com.google.tts.PrefsActivity
 * JD-Core Version:    0.5.3
 */